import React, { Component } from 'react'
//1. 创建ref对象
const xxxRef = React.createRef()
export default class App extends Component {
  render() {
    return (
      <div>
        {/* 2. 绑定 */}
        <input type="text" ref={xxxRef} />
        <button
          onClick={(e) => {
            // 点击按钮的时候,要修改input的值为123
            // console.log(xxxRef)
            xxxRef.current.value = '123'
          }}
        >
          按钮
        </button>
      </div>
    )
  }
}
